github.com/hyperion-hyn/go-ethereum@v2.4.0+incompatible/docs/Cakeshop/Getting started.md (about) 1 ## Quickstart 2 ### Requirements 3 4 * Java 8+ 5 * Java app server (Tomcat, Jetty, etc) [Optional] 6 7 ### Running via Spring Boot 8 9 * Download WAR file (Binary packages are available for macOS, Windows, and Linux platforms on the [releases](https://github.com/jpmorganchase/cakeshop/releases) page. 10 ) 11 * Run `java -jar cakeshop.war` 12 * Navigate to [http://localhost:8080/](http://localhost:8080/) 13 14 *Note: when running in Windows, -Dgeth.node=geth must be specified as Quorum is not yet available on Windows OS* 15 16 ### Running via App Server 17 18 * Download WAR file 19 * Put in `/webapps` folder of your app server 20 * Add Java system property `-Dspring.profiles.active=local` to startup script (`setenv.sh` for tomcat) 21 * Start app server 22 * Navigate to [http://localhost:8080/](http://localhost:8080/) (default port is usually 8080) 23 24 *Note: when running in Windows, -Dgeth.node=geth must be specified as Quorum is not yet available on Windows OS* 25 26 ### Running modes 27 28 There are a few ways in which you can run Cakeshop (see the sections below for details on each, as well as [configuration](https://github.com/jpmorganchase/cakeshop/blob/master/docs/configuration.md#geth) page): 29 30 1. **Default mode**: _Used when you want Cakeshop to start up an Ethereum node._ 31 32 Running Cakeshop in the Default mode will start up Cakeshop and also start running a regular geth node (on a private/test network). 33 34 2. **'Attach/Unmanaged' mode**: _Used when you want to attach Cakeshop to an already running Ethereum-like node._ 35 36 Running Cakeshop in 'Attach' a.k.a 'unmanaged' mode will initialize Cakeshop but not start it nor start any Ethereum node. Once Cakeshop initialization is complete you can configure it to use the RPC details of your running node . When you then start Cakeshop it will attach to your node. 37 38 NOTE: if different parties on the network are using Cakeshop to deploy contracts to the network then they need to ensure they are using the same ContractRegistry address. See details below for setting up the ContractRegistry address in this case. 39 40 3. **Multi-Instance Set Up**: _Used when you want to run Cakeshop on more than one node in your network._ 41 42 Cakeshop is currently designed such that a given instance of Cakeshop works directly with a single Ethereum-like node, however you can set up multiple instances of Cakeshop on the same machine (each which could either have been started in 'Default' mode or 'Attach' mode) such that each can talk to a different node. 43 44 NOTE: you can use the Attach mode and/or Multi-Instance setup configuration to run Cakeshop on [Quorum](https://github.com/jpmorganchase/quorum) nodes. See below for connecting Cakeshop to the [7nodes](https://github.com/jpmorganchase/quorum-examples/tree/master/examples/7nodes) network from the quorum-examples repo. 45 46 47 #### The below commands assume you have renamed the WAR file to cakeshop.war 48 49 ### Default Mode 50 1. In a terminal window run: 51 52 ``` 53 $ cd path/to/cakeshop/war 54 $ java -jar cakeshop.war 55 ``` 56 57 2. Open **http://localhost:8080/** in your browser (Firefox/Chrome supported) 58 59 ### Attach Mode 60 1. In a terminal window run: 61 62 ``` 63 $ cd path/to/cakeshop/war 64 # The 'example' arg below will unpack the war file and set up the cakeshop data folders but will not actually start a node 65 $ java -jar cakeshop.war example 66 ``` 67 2. Navigate to path/to/cakeshop/war/data/local 68 3. Make the following edits to the application.properties file: 69 * ensure `geth.auto.start` is set to `false` 70 * ensure `geth.auto.stop` is set to `false` 71 4. Run: 72 73 ``` 74 $ java -jar cakeshop.war 75 ``` 76 5. Open **http://localhost:8080/** in your browser (Firefox/Chrome supported) 77 6. The dropdown menu on the top right of the page should show "Manage Nodes" if you haven't attached to any yet. Click on that to go to the Manage Nodes page. 78 7. Click Add Node and input the RPC url of your Quorum node (i.e. http://localhost:22000) and the path to the Tessera P2P Party Info endpoint (i.e. http://localhost:9001/partyinfo). 79 8. Once added, click on View to attach to the node and return to the main Cakeshop page 80 81 ### Multi-Instance Setup 82 83 Although Cakeshop currently has a one-to-one mapping with the underlying Ethereum-like node that it connects to, it is possible to have multiple Cakeshop instances running on the same machine, each connecting to a different Ethereum-like node. The best way to achieve this is to create separate Cakeshop folders for each node and then attach to each separately. You should also configure the ContractRegistry address as per the below: 84 85 > ** Cakeshop ContractRegistry contract** 86 87 >Cakeshop deploys a ContractRegistry contract upon start up that is used to track those contracts that have been deployed to the chain using Cakeshop or the Cakeshop APIs. When running a multi-instance setup, you'll want to ensure that each instance of Cakeshop references the same ContractRegistry contract in order that each provides a consistent view within the Contracts Explorer. 88 89 >There are two cmd flags that can be set to achieve this: 90 91 > * `CAKESHOP_SHARED_CONFIG` (<em>recommended</em>): When this flag is set, Cakeshop will try to load a file called 'shared.properties' and read the ContractRegistry address from it. If the file doesn't exist, Cakeshop will deploy the ContractRegistry contract, create this file and store the address in the file. 92 93 > USAGE: `$ CAKESHOP_SHARED_CONFIG="{fileLocation}" java -jar cakeshop.war` 94 95 > * `CAKESHOP_REGISTRY_ADDR`: This flag will directly override whatever ContractRegistry address is configured (or not) and run with that address. Using this flag doesn't change any local Cakeshop settings nor save this address to file and so you would have to run with this flag again to use this address again. 96 97 > USAGE: `$ CAKESHOP_REGISTRY_ADDR="0xabcdefgh.." java -jar cakeshop.war` 98 99 100 1. In terminal window 1 run: 101 102 ``` 103 mkdir myNetwork && cd myNetwork 104 cp path/to/cakeshop/download /myNetwork 105 cd myNetwork 106 mkdir node1 node2 107 cd node1 108 CAKESHOP_SHARED_CONFIG=".." java -jar ../cakeshop.war example 109 ``` 110 111 2. Assuming you want to attach to an existing node, navigate to /myNetwork/node1/ and edit **application.properties** per the instructions for [attach mode](#attach-mode) as described above 112 113 3. In terminal window 2 run: 114 115 ``` 116 cd myNetwork/node2 117 CAKESHOP_SHARED_CONFIG=".." java -jar ../cakeshop.war example 118 ``` 119 120 4. Navigate to myNetwork/node2 and edit **application.properties** per the instructions for [attach mode](#attach-mode) as described above 121 5. In terminal window 1 run: 122 123 ``` 124 CAKESHOP_SHARED_CONFIG=".." java -jar ../cakeshop.war 125 ``` 126 127 6. In terminal window 2 run: 128 129 ``` 130 CAKESHOP_SHARED_CONFIG=".." java -Dserver.port=8081 -jar cakeshop.war # Cakeshop will now be available on localhost:8081 131 ``` 132 133 7. In browser window 1 open http://localhost:8080/ 134 135 8. In browser window 2 open http://localhost:8081/ 136 137 ### Running Cakeshop on quorum-examples 138 You can use the 'Attach' mode to use Cakeshop to explore the quorum-examples [7nodes](https://github.com/jpmorganchase/quorum-examples/tree/master/examples/7nodes) network. 139 140 To do so: 141 142 1. Follow the instructions in the [7nodes](https://github.com/jpmorganchase/quorum-examples/tree/master/examples/7nodes) example to start the 7nodes network (running vagrant up, init.sh, start.sh etc.) 143 2. Follow the instructions listed under the [Attach](#attach-mode) mode as described above, using the `rpcport` of the node you want to explore as found in the 7nodes [start.sh](https://github.com/jpmorganchase/quorum-examples/blob/master/examples/7nodes/start.sh) file. Equally, follow the [Multi-Instance](#multi-instance-setup) setup to attach to more than one of the Quorum nodes. 144 145 ### Confirming Cakeshop Start Up 146 In all cases, Cakeshop will be running once you see the below image, which shows the Cakeshop build and url that you can access that instance of Cakeshop on: 147 148  149